<?php
session_start();
include "connectdb.php";
$username = $_SESSION['sess_Username'];
$password = $_SESSION['sess_Password'];

$eva_question = $_POST["txtevaquestion"];   

$SQL_SELECT_MAX = "SELECT MAX(eva_id) FROM ag_evaluate ;";
$resultmax = mysql_query($SQL_SELECT_MAX);
$resultmax2 = mysql_result($resultmax,0);
$resultmax3 = $resultmax2+1;

for ($i=0;$i<count($evatype_array);$i++) {
$eva_typeid = $evatype_array[$i];
}

$SQL_INSERT_EVALUATE = "INSERT INTO ag_evaluate VALUES('$resultmax3','$eva_question','$eva_typeid') ;";
$result = mysql_db_query($dbname,$SQL_INSERT_EVALUATE);


if($result){
		?>
		<script>
		alert("เพิ่มรายการแบบประเมินเรียบร้อยแล้ว");
		</script>
        <meta http-equiv='refresh' content='0;URL=admin_evaluate.php'>
		<?
	}
	else 
	{
		?>
		<script>
		alert("ผิดพลาด");
		history.back();
		</script>
		<?
	}
?>

